package dd.prog2.musterExercises.ws12set08_word_cnt;

import java.util.Comparator;
import java.util.Map.Entry;

/**
 * Helper class, used to compare String-Integer-Map-Entities. By means of this
 * comparator, entries can be sorted with decreasing number values.
 * 
 * @author Ruediger Lunde
 * 
 */
public class EntryComparator implements Comparator<Entry<String, Integer>> {

	@Override
	public int compare(Entry<String, Integer> e1, Entry<String, Integer> e2) {
		int result = 0;//  -Integer.compare(e1.getValue(), e2.getValue());
		if (result == 0)
			result = e1.getKey().compareTo(e2.getKey());
		return result;
	}

}
